package com.wmx.reflect;

import java.lang.reflect.Constructor;

public class TestReflect {
    public static void main(String[] args) {

        try {
            Class class1 = Class.forName("com.wmx.reflect.StudentReflect");
            Constructor[] constructors = class1.getDeclaredConstructors();
            for (Constructor constructor : constructors) {
                System.out.println(constructor);
            }
            Constructor<StudentReflect> constructor1 = class1.getDeclaredConstructor(String.class);
            constructor1.setAccessible(true);
            StudentReflect studentReflect = constructor1.newInstance("wumengxin");
            System.out.println(studentReflect);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
